home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-08-22 | 24.5 KB | 625 lines | [TEXT/ttxt] |
- ;; This is an implementation of ZVAL for ALLEGRO.
- ;;
- ;; ZVAL makes it easy to try out code as you write it, and to debug
- ;; functions by evaluating them line by line in the editor.
- ;; You assign sample values to the parameters of a function and then
- ;; evaluate individual lines in the function in terms of these sample values.
- ;;
- ;; There are 3 basic commands:
- ;; (1) super-T: Evaluate expression.
- ;; The expression to the right of the cursor is evaluated.
- ;; (2) super-B: Evaluate LET binding.
- ;; The LET expression to the right of the cursor is evaluated.
- ;; e.g. (mystring (subseq "something" 0 4)) is evaluated as
- ;; (setq mystring (subseq "something" 0 4)).
- ;; This means that instead of BINDing the value of mystring, ZVAL
- ;; SETs the value at the top level.
- ;; (3) super-L: Evaluate FOR or WITH expression in a LOOP macro.
- ;;
- ;; The names are historical -- they name the keys the commands were assigned to
- ;; on Lisp machines.
- ;; In Allegro, the commands are assigned to function keys on the extended keyboard.
- ;; The assignments are made at the end of this file, so you can change them
- ;; to other keys if you wish.
- ;; super-T is assigned to F5.
- ;; super-B is assigned to F6.
- ;; super-L is assigned to F7.
- ;;
- ;; Holding down the Control key does Initial assignments:
- ;; To assign a value of your choice to a variable, hold down the Control key while
- ;; using the super-T command. You will be prompted for the value in the Lisp Listener.
- ;; The first time through a LOOP, hold down the Control key while using the super-L
- ;; command. This will assign initial values to variables, and also prepare future
- ;; values where appropriate.
- ;;
- ;; Holding down the Option key does Multiple assignments:
- ;; All of the LET assignments (option-super-B),
- ;; all of the expressions in the current form (option-super-T),
- ;; or all of the FOR and WITH assignments (option-super-L)
- ;; will be done in sequence.
- ;;
- ;;
- ;; THE TYPICAL WAY TO USE ZVAL IS TO:
- ;; 1) Use control-super-T to assign initial values to the parameters of a function.
- ;; 2) Use meta-super-B to set all of the LET bindings.
- ;; 3) Then, use super-T to step through the body of the function.
- ;; 4) Use super-L whenever you encounter a LOOP macro.
- ;;
- ;;
- ;;
- ;; ADDITIONAL FEATURES:
- ;; (1). The F8 key is assigned to Set Variable To Yank. This is like control-super-T, except
- ;; that instead of prompting the user for the value, the top item from the kill ring
- ;; is yanked and evaluated.
- ;;
- ;; (2). There is a kludged version of GrabArgs assigned to F9.
- ;; Grabargs is used when one of your functions BREAKs. In the editor, put your cursor
- ;; on the first argument in the defun of the function in the BREAK (that's the kludgey
- ;; part). When you press F9, all of the arguments to the function will be SETQ'd to
- ;; their values in the BREAK. You can then use ZVAL to step through the body of the
- ;; function and see where it fails.
- ;; For example, if you have a function
- ;; (defun TEST.FOR.SIMILAR.OBJECTS (object1 object2) ...
- ;; which breaks, put the cursor just before the "o" in "object1" and press F9.
- ;; Object1 and object2 will be setq'd to the values which caused the break.
- ;; Using the other ZVAL commands to step through TEST.FOR.SIMILAR.OBJECTS,
- ;; you will see which line in the function causes the break.
-
-
- (defvar *zval.window*)
- (defvar *zval-alist* nil)
- (defvar *tab.space* " ")
- (setf (subseq *tab.space* 1 2) (string #\Tab))
- (defvar *tab.space.return* " ")
- (setf (subseq *tab.space.return* 1 2) (string #\Tab))
- (setf (subseq *tab.space.return* 2 3) (string #\Return))
-
-
- (defun CREATE.ZVAL.WINDOW ()
- (setq *zval.window*
- (oneof *fred-window*
- :window-position (make-point 10 50)
- :window-size (make-point 200 100)
- :window-title "ZVAL"
- :scratch-p t))
- (ask *zval.window* (ccl::window-hide))
- )
-
- (defun zval-let-binding ()
- "The equivalent of super-B"
- (let* ((window (first (windows *fred-window*)))
- (buffer (ask window (window-buffer)))
- (mark (ask window (window-cursor-mark)))
- (zval.window *zval.window*)
- (zval.buffer (ask zval.window (window-buffer)))
- zval.mark first.char
- )
- (skip-whitespace buffer mark)
- (setq first.char (ccl::buffer-char buffer mark))
- (ask window (ccl::ed-select-current-sexp))
- (ask window (ccl::ed-copy-region-as-kill))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (skip-whitespace buffer mark)
- (when (eql #\; (ccl::buffer-char buffer mark))
- (loop for char = (ccl::buffer-char buffer mark)
- while (eql #\; char)
- do
- (ask window (ccl::ed-next-line))
- (ask window (ccl::ed-beginning-of-line))
- (skip-whitespace buffer mark)
- )
- )
- (if (eql #\) (ccl::buffer-char buffer mark))
- (set-mark mark (ccl::buffer-char-pos buffer #\( :start mark)))
- (cond
- ((eql first.char #\()
- (ask zval.window (ccl::ed-yank))
- (ask zval.window (ccl::ed-backward-sexp))
- (ask zval.window (ccl::ed-forward-char))
- (setq zval.mark (ask zval.window (window-cursor-mark)))
- (ccl::buffer-insert zval.buffer "setq " zval.mark))
- (t
- (setq zval.mark (ask zval.window (window-cursor-mark)))
- (ccl::buffer-insert zval.buffer "(setq " zval.mark)
- (ask zval.window (ccl::ed-yank))
- (ccl::buffer-insert zval.buffer " nil)" zval.mark))
- )
- (ask zval.window (ccl::ed-beginning-of-line))
- (ask zval.window (ccl::ed-forward-sexp))
- (ask zval.window (ccl::ed-eval-or-compile-current-sexp))
- (ccl::buffer-insert zval.buffer "
- " zval.mark)
- ))
-
- (defun zval-let-bindings ()
- "Repeated super-Bs until the end of the let bindings is reached."
- (let* ((window (first (windows *fred-window*)))
- (buffer (ask window (window-buffer)))
- (mark (ask window (window-cursor-mark)))
- (zval.window *zval.window*)
- (zval.buffer (ask zval.window (window-buffer)))
- zval.mark first.char
- )
- (loop
- do
- (skip-whitespace buffer mark)
- (setq first.char (ccl::buffer-char buffer mark))
- (ask window (ccl::ed-select-current-sexp))
- (ask window (ccl::ed-copy-region-as-kill))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (skip-whitespace buffer mark)
- (when (eql #\; (ccl::buffer-char buffer mark))
- (loop for char = (ccl::buffer-char buffer mark)
- while (eql #\; char)
- do
- (ask window (ccl::ed-next-line))
- (ask window (ccl::ed-beginning-of-line))
- (skip-whitespace buffer mark)
- )
- )
- (cond
- ((eql first.char #\()
- (ask zval.window (ccl::ed-yank))
- (ask zval.window (ccl::ed-backward-sexp))
- (ask zval.window (ccl::ed-forward-char))
- (setq zval.mark (ask zval.window (window-cursor-mark)))
- (ccl::buffer-insert zval.buffer "setq " zval.mark))
- (t
- (setq zval.mark (ask zval.window (window-cursor-mark)))
- (ccl::buffer-insert zval.buffer "(setq " zval.mark)
- (ask zval.window (ccl::ed-yank))
- (ccl::buffer-insert zval.buffer " nil)" zval.mark))
- )
- (ask zval.window (ccl::ed-beginning-of-line))
- (ask zval.window (ccl::ed-forward-sexp))
- (ask zval.window (ccl::ed-eval-or-compile-current-sexp))
- (ccl::buffer-insert zval.buffer "
- " zval.mark)
- until (eql #\) (ccl::buffer-char buffer mark))
- )
- (set-mark mark (ccl::buffer-char-pos buffer #\( :start mark))
- ))
-
- (defun zval-setq ()
- "super-1 super-T: set the variable to the right of the cursor
- to the value of an expression entered in the listener"
- (let* ((window (first (windows *fred-window*)))
- (buffer (ask window (window-buffer)))
- (mark (ask window (window-cursor-mark)))
- (l-window (listener-window))
- (l-buffer (ask l-window (window-buffer)))
- var.name
- )
- (setq var.name (ccl::buffer-current-sexp buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (when (eql #\Space (ccl::buffer-char buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-bwd-sexp buffer mark)))
- (ccl::buffer-insert l-buffer (format nil "(setq ~A " var.name))
- (ask l-window (window-update))
- (ask l-window (window-select))
- ))
-
- (defun zval-setq-to-yank ()
- "Modified super-1 super-T: set the variable to the right of the cursor
- to the value of the expression in the kill ring."
- (let* ((window (first (windows *fred-window*)))
- (buffer (ask window (window-buffer)))
- (mark (ask window (window-cursor-mark)))
- var.name value
- )
- (setq var.name (ccl::buffer-current-sexp buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (when (eql #\Space (ccl::buffer-char buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-bwd-sexp buffer mark)))
- (setq value (eval (get-item-from-kill-ring)))
- (set var.name value)
- (show-user "Setting ~A to ~A." var.name value)
- (ask (listener-window) (window-update))
- ))
-
- (defun zval-eval ()
- "super-T: evaluate the expression to the right of the cursor, then move
- cursor to next expression."
- (let* ((window (first (windows *fred-window*)))
- (buffer (ask window (window-buffer)))
- (mark (ask window (window-cursor-mark)))
- )
- (skip-whitespace buffer mark)
- (when (member (ccl::buffer-current-sexp buffer mark)
- '(if else while until always never finally do collect append nconc))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (skip-whitespace buffer mark)
- )
- (ask window (ccl::ed-eval-or-compile-current-sexp))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (skip-whitespace buffer mark)
- ;; Skip over &optional and &rest in arglist
- (when (eql #\& (ccl::buffer-char buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-bwd-sexp buffer mark)))
- ))
-
- (defun zval-evals ()
- "Repeated super-Ts until the end of the body is reached."
- (let* ((window (first (windows *fred-window*)))
- (buffer (ask window (window-buffer)))
- (mark (ask window (window-cursor-mark)))
- )
- (loop
- do
- (skip-whitespace buffer mark)
- (when (member (ccl::buffer-current-sexp buffer mark)
- '(if else while until finally do collect append nconc))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (skip-whitespace buffer mark)
- )
- ;; Skip over &optional and &rest in arglist
- (when (eql #\& (ccl::buffer-char buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-bwd-sexp buffer mark)))
- (ask window (ccl::ed-eval-or-compile-current-sexp))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (skip-whitespace buffer mark)
- until (eql #\) (ccl::buffer-char buffer mark))
- )
- ))
-
- (defun zval-initial-loop-binding ()
- "super-1 super-L. Get the first value for a loop variable."
- (let* ((window (first (windows *fred-window*)))
- (buffer (ask window (window-buffer)))
- (mark (ask window (window-cursor-mark)))
- sexp var.name var.val var.vals var.end.val
- (l-window (listener-window))
- )
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (setq sexp (ccl::buffer-current-sexp buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (cond
- ((eql sexp 'for) ;; FOR X ...
- (setq var.name (ccl::buffer-current-sexp buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (setq sexp (ccl::buffer-current-sexp buffer mark))
- (set-mark mark (ccl::buffer-bwd-sexp buffer mark))
- (cond
- ((eql sexp '=) ;; FOR X = Y, FOR X = Y THEN Z
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (setq var.val (eval (ccl::buffer-current-sexp buffer mark)))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-bwd-sexp buffer mark))
- (set var.name var.val)
- (setq sexp (ccl::buffer-current-sexp buffer mark))
- (when (eql sexp 'then)
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-bwd-sexp buffer mark))
- )
- (show-user "~A = ~A" var.name var.val)
- )
- ((eql sexp 'in) ;; FOR X IN XLIST
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (setq var.vals (eval (ccl::buffer-current-sexp buffer mark)))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-bwd-sexp buffer mark))
- (cond ((eql 0 (length var.vals))
- (ed-beep)
- (show-user "Null sequence for ~A" var.name))
- (t
- (set var.name (first var.vals))
- (setq *zval-alist*
- (acons var.name (cdr var.vals) *zval-alist*))
- (show-user "~A = ~A THEN: ~A"
- var.name (first var.vals) (cdr var.vals)))
- )
- )
- ((eql sexp 'from) ;; FOR X FROM 1, FOR X FROM 1 TO 3
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (setq var.val (eval (ccl::buffer-current-sexp buffer mark)))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-bwd-sexp buffer mark))
- (set var.name var.val)
- (setq sexp (ccl::buffer-current-sexp buffer mark))
- (setq var.end.val nil)
- (when (eql sexp 'to)
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (setq var.end.val (eval (ccl::buffer-current-sexp buffer mark)))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-bwd-sexp buffer mark))
- )
- (setq var.vals (cdr (integer-list var.val var.end.val 10)))
- (setq *zval-alist* (acons var.name var.vals *zval-alist*))
- (show-user "~A = ~A THEN: ~A" var.name var.val var.vals)
- )
- ))
- ((eql sexp 'with) ;; WITH X ...
- (setq var.name (ccl::buffer-current-sexp buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-bwd-sexp buffer mark))
- (setq sexp (ccl::buffer-current-sexp buffer mark))
- (setq var.val nil)
- (when
- (eql sexp '=) ;; WITH X = Y
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (setq var.val (eval (ccl::buffer-current-sexp buffer mark)))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-bwd-sexp buffer mark))
- )
- (set var.name var.val)
- (show-user "~A = ~A" var.name var.val)
- )
- )
- (ask l-window (window-update))
- ))
-
- (defun zval-loop-binding ()
- "super-L. Get the next value for a loop variable."
- (let* ((window (first (windows *fred-window*)))
- (buffer (ask window (window-buffer)))
- (mark (ask window (window-cursor-mark)))
- sexp var.name var.val
- first.val pair
- )
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (setq sexp (ccl::buffer-current-sexp buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (cond
- ((eql sexp 'for) ;; FOR X ...
- (setq var.name (ccl::buffer-current-sexp buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (setq sexp (ccl::buffer-current-sexp buffer mark))
- (set-mark mark (ccl::buffer-bwd-sexp buffer mark))
- (cond
- ((eql sexp '=) ;; FOR X = Y, FOR X = Y THEN Z
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (setq first.val (eval (ccl::buffer-current-sexp buffer mark)))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-bwd-sexp buffer mark))
- (setq sexp (ccl::buffer-current-sexp buffer mark))
- (cond
- ((eql sexp 'then)
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (setq var.val (eval (ccl::buffer-current-sexp buffer mark)))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-bwd-sexp buffer mark))
- )
- (t (setq var.val first.val))
- )
- (set var.name var.val)
- (show-user "~A = ~A" var.name var.val)
- )
- ((eql sexp 'in) ;; FOR X IN XLIST
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (setq pair (assoc var.name *zval-alist*))
- (cond ((> (length (cdr pair)) 0)
- (setq var.val (first (cdr pair)))
- (set var.name var.val)
- (show-user "~A = ~A THEN: ~A"
- var.name var.val (cddr pair)))
- (t (ed-beep)
- (show-user "Sequence terminated for ~A" var.name))
- )
- (if pair (rplacd pair (cddr pair)))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-bwd-sexp buffer mark))
- )
- ((eql sexp 'from) ;; FOR X FROM 1, FOR X FROM 1 TO 3
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (setq pair (assoc var.name *zval-alist*))
- (cond ((> (length (cdr pair)) 0)
- (setq var.val (first (cdr pair)))
- (set var.name var.val)
- (show-user "~A = ~A THEN: ~A"
- var.name var.val (cddr pair)))
- (t (ed-beep)
- (show-user "Sequence terminated for ~A" var.name))
- )
- (if pair (rplacd pair (cddr pair)))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-bwd-sexp buffer mark))
- (setq sexp (ccl::buffer-current-sexp buffer mark))
- (when (eql sexp 'to)
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-bwd-sexp buffer mark))
- )
- )
- ))
- ((eql sexp 'with) ;; WITH X ...
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-bwd-sexp buffer mark))
- (setq sexp (ccl::buffer-current-sexp buffer mark))
- (when
- (eql sexp '=) ;; WITH X = Y
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (set-mark mark (ccl::buffer-bwd-sexp buffer mark))
- )
- )
- )
- (ask (listener-window) (window-update))
- ))
-
- (defun zval-initial-loop-bindings ()
- "Multiple 'FOR' and 'WITH' intial bindings"
- (let* ((window (first (windows *fred-window*)))
- (buffer (ask window (window-buffer)))
- (mark (ask window (window-cursor-mark)))
- )
- (loop for keyword = (ccl::buffer-current-sexp buffer mark)
- while (member keyword '(for with))
- do (zval-initial-loop-binding)
- )
- ))
-
- (defun zval-loop-bindings ()
- "Multiple 'FOR' and 'WITH' bindings"
- (let* ((window (first (windows *fred-window*)))
- (buffer (ask window (window-buffer)))
- (mark (ask window (window-cursor-mark)))
- )
- (loop for keyword = (ccl::buffer-current-sexp buffer mark)
- while (member keyword '(for with))
- do (zval-loop-binding)
- )
- ))
-
- (defun ga ()
- "Kludged because it's hard to get hold of backtrace info.
- Put the cursor on the first arg in the defun's arglist."
- (declare (special val0 val1 val2 val3 val4 val5 val6 val7 val8 val9))
- (let* ((window (first (windows *fred-window*)))
- (buffer (ask window (window-buffer)))
- (mark (ask window (window-cursor-mark)))
- )
- (setq val0 (local 0))
- (setq val1 (local 1))
- (setq val2 (local 2))
- (setq val3 (local 3))
- (setq val4 (local 4))
- (setq val5 (local 5))
- (setq val6 (local 6))
- (setq val7 (local 7))
- (setq val8 (local 8))
- (setq val9 (local 9))
- (loop for count from 0 to 9
- with arg.name
- do (setq arg.name (NEXT.ARG.NAME buffer mark))
- while arg.name
- do (set arg.name (symbol-value (name 'val count)))
- (show-user "~A = ~A" arg.name (symbol-value (name 'val count)))
- )
- (ask (listener-window) (window-update))
- ))
-
- ;;; Auxiliary functions
-
- (defun next.arg.name (buffer mark)
- (let (arg.name
- )
- (loop
- do (set-mark mark (ccl::buffer-fwd-sexp buffer mark))
- (setq arg.name (ccl::buffer-current-sexp buffer mark))
- if (not (symbolp arg.name))
- return nil
- else if (not (member (subseq (string arg.name) 0 1) '("&" ":") :test 'string-equal))
- return arg.name
- )
- ))
-
- (defun skip-whitespace (buffer mark)
- (if (member (ccl::buffer-char buffer mark) '(#\Space #\Tab #\Return))
- (set-mark mark (ccl::buffer-not-char-pos buffer *tab.space.return*
- :start mark)))
- )
-
-
- (defun integer-list (start.num end.num &optional max.size)
- "(integer-list 3 7) returns (3 4 5 6 7). If max.size is 3,
- returns (3 4 5). If end.num is nil, returns list of size max.size or 10"
- (if (null end.num)
- (setq end.num (+ start.num (or max.size 10))))
- (when (>= end.num start.num)
- (loop for integer from start.num to end.num
- for count from 1
- until (and max.size (> count max.size))
- collect integer)
- )
- )
-
- (defun listener-window ()
- "Find the lisp listener window"
- (let* ((windows (windows *fred-window*))
- listener
- )
- (setq listener
- (loop for window in windows
- for name = (ask window ccl::object-name)
- if (string-equal name "Listener")
- return window))
- ))
-
- (defun show-user (format-string &rest format-args)
- "Formats the string into the lisp-listener"
- (let* ((l-window (listener-window))
- (l-buffer (ask l-window (window-buffer)))
- (l-window-start-mark (ask l-window (ccl::window-start-mark)))
- )
- (ccl::buffer-insert l-buffer
- (apply 'format nil
- (concatenate 'string format-string "~%")
- format-args)
- (buffer-line-start l-buffer))
- (set-mark l-window-start-mark
- (ccl::buffer-line-start l-window-start-mark nil 1))
-
- ))
-
- (defun my-pop-string-from-kill-ring ()
- (let ((string-to-pop (caar ccl::*killed-string-yank-pointer*)))
- (rplaca ccl::*killed-string-yank-pointer* (cons "" nil))
- (setq ccl::*killed-string-yank-pointer*
- (cdr ccl::*killed-string-yank-pointer*))
- string-to-pop))
-
- (defun get-item-from-kill-ring ()
- (let* ((zval.window *zval.window*)
- (zval.buffer (ask zval.window (window-buffer)))
- zval.mark
- )
- (ask zval.window (select-all))
- (ask zval.window (ccl::ed-yank))
- (ask zval.window (select-all))
- (ccl::buffer-current-sexp zval.buffer zval.mark)
- ))
-
-
-
-
- (create.zval.window)
-
- ;; KEY ASSIGNMENTS
- (def-fred-command (:function #\5) zval-let-binding)
- (def-fred-command (:function :meta #\5) zval-let-bindings)
- (def-fred-command (:function #\6) zval-eval)
- (def-fred-command (:function :meta #\6) zval-evals)
- (def-fred-command (:function :control #\6) zval-setq)
- (def-fred-command (:function #\7) zval-loop-binding)
- (def-fred-command (:function :meta #\7) zval-loop-bindings)
- (def-fred-command (:function :control #\7) zval-initial-loop-binding)
- (def-fred-command (:function :control :meta #\7) zval-initial-loop-bindings)
- (def-fred-command (:function #\8) zval-setq-to-yank)
- (def-fred-command (:function #\9) ga)
-
-
- #|
- (defun tryloops ()
- (let* ((a '(my this is))
- (b 5)
- )
- (loop for x = (first a)
- for x1 = 12 then b
- for y in a
- for z from 7
- for w from 9 to 12
- with c1
- with c2 = 66
- do (setq x 100)
- )))
- |#
-